const Koa = require('koa');
const app = new Koa();

app.use(async(ctx)=>{
    //获得请求地址
    let url = ctx.url;
    //从request中接受get请求
    let request = ctx.request;
    let req_query = request.query;

    //从上下文中获取get请求
    let ctx_query = ctx.query;

    ctx.body = {
        url,
        req_query,
        ctx_query
    }
});

// 监听端口
app.listen(3000,() => {
    //监听回调
    console.log('app is start at port 3000');
});
